//
//  NewsTableViewCell.m
//  GentlemanAnime
//
//  Created by dlios on 15-6-29.
//  Copyright (c) 2015年 lanou3g.com 蓝欧科技. All rights reserved.
//

#import "NewsTableViewCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height

@implementation NewsTableViewCell

- (void)dealloc
{
    [_TimeLabel release];
    [_TitleLabel release];
    [_BrowseLabel release];
    [_AnimeImageView release];
    [_ReleaseLabel release];
    [_DescribeLabel release];
    [super dealloc];
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        
        self.TimeLabel = [[UILabel alloc]init];
         self.TimeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.TimeLabel];
        [_TimeLabel release];
        
        self.TitleLabel = [[UILabel alloc]init];
        [self.TitleLabel sizeToFit];
        self.TitleLabel.font = [UIFont boldSystemFontOfSize:14];
        [self.contentView addSubview:self.TitleLabel];
        [_TitleLabel release];
        
        self.DescribeLabel = [[UILabel alloc]init];
        self.DescribeLabel.numberOfLines = 0;
        self.DescribeLabel.textColor = [UIColor grayColor];
        [self.DescribeLabel sizeToFit];
        self.DescribeLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.DescribeLabel];
        [_DescribeLabel release];
        
        self.BrowseLabel = [[UILabel alloc]init];
        self.BrowseLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.BrowseLabel];
        [_BrowseLabel release];
        
        //发布的频道
        self.ReleaseLabel = [[UILabel alloc]init];
        self.ReleaseLabel.font = [UIFont systemFontOfSize:12];
        [self.contentView addSubview:self.ReleaseLabel];
        [_ReleaseLabel release];
        
 //图片的位置
        self.PicareButton = [[UIImageView alloc] init];
        
        [self.contentView addSubview:self.PicareButton];
        self.PicareButton.image = [UIImage imageNamed:@"Image-6"];
        [_PicareButton release];
        
        //浏览量的button按钮
        self.BrowseButton = [[UIImageView alloc] init];
        [self.contentView addSubview:self.BrowseButton];
        self.BrowseButton.image = [UIImage imageNamed:@"热ICON"];
        [_BrowseButton release];
        
        //没有添加背景颜色
        self.AnimeImageView = [[UIImageView alloc]init];
        [self.contentView addSubview:self.AnimeImageView];
        self.AnimeImageView.layer.borderWidth = 1;
        self.AnimeImageView.layer.borderColor = [[UIColor grayColor] CGColor];
        self.AnimeImageView.layer.masksToBounds = YES;
        [_AnimeImageView release];
    }
    return self;
}
-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.AnimeImageView.frame = CGRectMake(5, 5, HEIGHT - 10  , HEIGHT - 10 );
    
    self.TitleLabel.frame = CGRectMake(self.AnimeImageView.frame.origin.x + self.AnimeImageView.frame.size.width + 10, 5, WIDTH - self.AnimeImageView.frame.size.width - 20 , 20);
    
    self.DescribeLabel.frame = CGRectMake(self.TitleLabel.frame.origin.x, self.TitleLabel.frame.origin.y + self.TitleLabel.frame.size.height, self.TitleLabel.frame.size.width, 40);
    
    self.PicareButton.frame = CGRectMake(self.DescribeLabel.frame.origin.x, HEIGHT - 22, 15, 15);
    
    self.ReleaseLabel.frame = CGRectMake(self.PicareButton.frame.origin.x + 18 ,HEIGHT - 25, 70, 20);
    
    self.TimeLabel.frame = CGRectMake(self.ReleaseLabel.frame.origin.x + 80, HEIGHT - 25, 52, 20);
    
    self.BrowseButton.frame = CGRectMake(self.TimeLabel.frame.origin.x + self.TimeLabel.frame.size.width + 5, HEIGHT -23, 15, 15);
    
    self.BrowseLabel.frame = CGRectMake(self.BrowseButton.frame.origin.x + 20, HEIGHT - 25, 40, 20);

    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
